package strangeattractor.UI;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

public class MainApp extends JFrame {

	private JPanel container = new JPanel();
	
	public MainApp(){
		super("Strange Attractor Viewer");
		initialize();
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	
	private void initialize(){
		container.setLayout(new FlowLayout());
		JButton lorenzButton = new JButton("New Lorenz Attractor");
		lorenzButton.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				JFrame frame = new JFrame();
				frame.add(new LorenzModifier());
				frame.setSize(new Dimension(700, 500));
				frame.setVisible(true);
			}
			
		});
		JButton lorenz84Button = new JButton("New Lorenz-84 Attractor");
		lorenz84Button.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				JFrame frame = new JFrame();
				frame.add(new Lorenz84Modifier());
				frame.setSize(new Dimension(700, 500));
				frame.setVisible(true);
			}
			
		});
		JButton pickoverButton = new JButton("New Pickover Attractor");
		pickoverButton.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				JFrame frame = new JFrame();
				frame.add(new PickoverModifier());
				frame.setSize(new Dimension(700, 500));
				frame.setVisible(true);
			}
			
		});
		
		this.add(container);
		container.add(pickoverButton);
		container.add(lorenzButton);
		container.add(lorenz84Button);
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		MainApp app = new MainApp();
		app.setSize(640, 480);
		app.setVisible(true);
	}

}
